import {request} from "./request";

/**
 * 获取分类数据
 * @returns {Promise | Promise<unknown>}
 */
export function getCategory() {
  return request({
    url: '/category',
    methods: 'get'
  })
}

/**
 * 得到类别细节
 */
export function getCategoryDetail(miniWallkey,type) {
  return request({
    url: '/subcategory/detail',
    methods: 'get',
    params: {
      miniWallkey: miniWallkey,
      type: type
    }
  });
};

/**
 * 获取分类数据
 */
export function categoryClassify(maitKey) {
  return request({
    url: '/subcategory',
    methods: 'get',
    params: {
      maitKey: maitKey
    }
  });
}

export class getCategoryList {
  constructor(list) {
    for (let item of list){
      this.title = item.title;
      this.img = item.img;
      this.price = item.price;
      this.cfav = item.cfav;
    }
  }
}